﻿<%@ Page Title="" Language="C#" MasterPageFile="~/App_SiteMasterPage/Site.Master"
    AutoEventWireup="true" CodeBehind="AddUser.aspx.cs" Inherits="eProject.Web.UI.AddUserPage" %>

<%@ Register Src="~/Controls/UserMenu.ascx" TagName="UserMenu" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="script" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="LeftContent" runat="server">
    <uc1:UserMenu ID="UserMenu1" runat="server" />
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="RightContent" runat="server">
    <div class="widget">
        <div class="widget-inner">
            <div class="widget-title">
                <h5>
                    <asp:Literal ID="ltHeader" runat="server" /></h5>
            </div>
            <div class="widget-content">
                <!--[if lt IE 9]><div class="ie"><![endif]-->
                <asp:ValidationSummary ID="sumRegister" runat="server" ValidationGroup="Register"
                    CssClass="frmValidation" />
                <div class="frm">
                    <fieldset>
                        <dl>
                            <dt>
                                <asp:Label ID="lblUser" runat="server" AssociatedControlID="txtUserName" />
                            </dt>
                            <dd>
                                <asp:TextBox ID="txtUserName" runat="server" placeholder="Enter UserName" />
                                <asp:CustomValidator ID="cusUserName" runat="server" ValidationGroup="Register" Display="Dynamic"
                                    CssClass="txtError" ClientValidationFunction="cusUserName_ClientValidate" Text="*" />
                            </dd>
                        </dl>
                        <dl>
                            <dt>
                                <asp:Label ID="lblPassword" runat="server" AssociatedControlID="txtPassword" />
                            </dt>
                            <dd>
                                <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" placeholder="Enter password" />
                                <asp:CustomValidator ID="cusPassword" runat="server" ValidationGroup="Register" Display="Dynamic"
                                    CssClass="txtError" ClientValidationFunction="cusPassword_ClientValidate" Text="*" />
                            </dd>
                        </dl>
                        <dl>
                            <dt>
                                <asp:Label ID="lblConfirmPassword" runat="server" AssociatedControlID="txtConfirmPassword" />
                            </dt>
                            <dd>
                                <asp:TextBox ID="txtConfirmPassword" runat="server" TextMode="Password" placeholder="Confirm password" />
                                <asp:CompareValidator ID="cpConfirmPassword" runat="server" ControlToValidate="txtConfirmPassword"
                                    ControlToCompare="txtPassword" ValidationGroup="Register" Display="Dynamic" CssClass="txtError"
                                    Text="*" ErrorMessage="Comfirm password not match." />
                            </dd>
                        </dl>
                        <dl>
                            <dt>
                                <asp:Label ID="lblEmail" runat="server" AssociatedControlID="txtEmail" />
                            </dt>
                            <dd>
                                <asp:TextBox ID="txtEmail" runat="server" placeholder="example@aptech.vn" />
                                <asp:CustomValidator ID="cusEmail" runat="server" ValidationGroup="Register" Display="Dynamic"
                                    CssClass="txtError" ClientValidationFunction="cusEmail_ClientValidate" Text="*" />
                            </dd>
                        </dl>
                        <dl>
                            <dt>
                                <asp:Label ID="lblFirstName" runat="server" AssociatedControlID="txtFirstName" />
                            </dt>
                            <dd>
                                <asp:TextBox ID="txtFirstName" runat="server" placeholder="Enter First Name" />
                                <asp:RequiredFieldValidator ID="rfvFirstName" runat="server" ControlToValidate="txtFirstName"
                                    ValidationGroup="Register" Display="Dynamic" CssClass="txtError" Text="*" ErrorMessage="Enter first name." />
                            </dd>
                        </dl>
                        <dl>
                            <dt>
                                <asp:Label ID="lblLastName" runat="server" AssociatedControlID="txtLastName" />
                            </dt>
                            <dd>
                                <asp:TextBox ID="txtLastName" runat="server" placeholder="Enter Last Name" />
                                <asp:RequiredFieldValidator ID="rfvLastName" runat="server" ControlToValidate="txtLastName"
                                    ValidationGroup="Register" Display="Dynamic" CssClass="txtError" Text="*" ErrorMessage="Enter last name." />
                            </dd>
                        </dl>
                        <dl>
                            <dt>
                                <asp:Label ID="lblDateOfBirth" runat="server" AssociatedControlID="txtDateOfBirth" /><br />
                                <asp:Label ID="lblDateOfBirthFormat" runat="server" Text="Date format: dd/mm/yyyy" />
                            </dt>
                            <dd>
                                <asp:TextBox ID="txtDateOfBirth" runat="server" placeholder="dd/mm/yyyy" />
                                <asp:RequiredFieldValidator ID="rfvDateOfBirth" runat="server" ControlToValidate="txtDateOfBirth"
                                    ValidationGroup="Register" Display="Dynamic" CssClass="txtError" Text="*" ErrorMessage="Enter date of birth." />
                            </dd>
                        </dl>
                        <dl>
                            <dt>
                                <asp:Label ID="lblGender" runat="server" AssociatedControlID="rdGender" />
                            </dt>
                            <dd>
                                <asp:RadioButtonList ID="rdGender" runat="server" RepeatDirection="Horizontal">
                                    <asp:ListItem Value="1" Selected="True" Text="Male" />
                                    <asp:ListItem Value="0" Text="FeMale" />
                                </asp:RadioButtonList>
                            </dd>
                        </dl>
                        <dl>
                            <dt>
                                <asp:Label ID="lblAddress" runat="server" AssociatedControlID="txtAddress" />
                            </dt>
                            <dd>
                                <asp:TextBox ID="txtAddress" runat="server" placeholder="Enter Address" />
                                <asp:RequiredFieldValidator ID="rfvAddress" runat="server" ControlToValidate="txtAddress"
                                    ValidationGroup="Register" Display="Dynamic" CssClass="txtError" Text="*" ErrorMessage="Enter address." />
                            </dd>
                        </dl>
                        <dl>
                            <dt>
                                <asp:Label ID="lblPhoneNumber" runat="server" AssociatedControlID="txtPhoneNumber" />
                            </dt>
                            <dd>
                                <asp:TextBox ID="txtPhoneNumber" runat="server" placeholder="(234) 5678-9012" />
                                <asp:RequiredFieldValidator ID="rfvPhoneNumber" runat="server" ControlToValidate="txtPhoneNumber"
                                    ValidationGroup="Register" Display="Dynamic" CssClass="txtError" Text="*" ErrorMessage="Enter Phone number." />
                            </dd>
                        </dl>
                        <dl>
                            <dt>
                                <asp:Label ID="lblDistance" runat="server" AssociatedControlID="txtDistance" />
                            </dt>
                            <dd>
                                <asp:TextBox ID="txtDistance" runat="server" Text="0" />
                            </dd>
                        </dl>
                        <asp:Panel ID="pnlCreatedDate" runat="server">
                        <dl>
                            <dt>
                                <asp:Label ID="lblCreatedDate" runat="server" AssociatedControlID="ltCreatedDate" />
                            </dt>
                            <dd>
                                <asp:Literal ID="ltCreatedDate" runat="server" />
                            </dd>
                        </dl>
                        <dl>
                            <dt>
                                <asp:Label ID="lblLastUpdate" runat="server" AssociatedControlID="ltLastUpdate" />
                            </dt>
                            <dd>
                                <asp:Literal ID="ltLastUpdate" runat="server" />
                            </dd>
                        </dl>
                        </asp:Panel>
                    </fieldset>
                    <fieldset class="div-button">
                        <div>
                            <asp:Button ID="btnSave" runat="server" CssClass="btn button1" ValidationGroup="Register"
                                Text="Save" />
                            <input class="btn button2" name="btn_cancel" value="Reset" type="reset" />
                        </div>
                    </fieldset>
                </div>
                <!--[if lt IE 9]></div><![endif]-->
            </div>
        </div>
    </div>
    <script type="text/javascript">

        function cusUserName_ClientValidate(sender, args) {
            var username = $('#<%=txtUserName.ClientID%>');
            if (username.val().length == 0) {
                sender.errormessage = "Enter User name.";
                args.IsValid = false;
            }
            else if (username.val().length < 4 || username.val().length > 15) {
                sender.errormessage = "User name 4-15 character.";
                args.IsValid = false;
            }
        }

        function cusPassword_ClientValidate(sender, args) {
            var password = $('#<%=txtPassword.ClientID%>');
            if (password.val().length == 0) {
                sender.errormessage = "Enter Password.";
                args.IsValid = false;
            }
            else if (password.val().length < 4 || password.val().length > 15) {
                sender.errormessage = "Password 4-15 character.";
                args.IsValid = false;
            }
        }

        function cusEmail_ClientValidate(sender, args) {
            var email = $('#<%=txtEmail.ClientID%>');
            if (email.val().length == 0) {
                sender.errormessage = "Enter email.";
                args.IsValid = false;
            }
            else if (email.val().length > 0) {
                var filter = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
                if (filter.test(email.val())) {
                    args.IsValid = true;
                }
                else {
                    sender.errormessage = "Enter valid email.";
                    args.IsValid = false;
                }
            }
        }

        $(function () {
            $("#<%=txtDateOfBirth.ClientID %>").mask("99/99/9999");
            $("#<%=txtPhoneNumber.ClientID %>").mask("(999) 9999-9999");
        });
    </script>
</asp:Content>
